package com.jeegit.ecms.service.impl;

import java.util.List;
import com.jeegit.common.utils.DateUtils;
import com.jeegit.common.utils.IdUtils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.jeegit.ecms.mapper.CmsVideoChapterMapper;
import com.jeegit.ecms.domain.CmsVideoChapter;
import com.jeegit.ecms.service.ICmsVideoChapterService;
import com.jeegit.common.core.text.Convert;

/**
 * 视频章节Service业务层处理
 * 
 * @author jeegit
 * @date 2022-06-27
 */
@Service
public class CmsVideoChapterServiceImpl implements ICmsVideoChapterService 
{
    @Autowired
    private CmsVideoChapterMapper cmsVideoChapterMapper;

    /**
     * 查询视频章节
     * 
     * @param id 视频章节主键
     * @return 视频章节
     */
    @Override
    public CmsVideoChapter selectCmsVideoChapterById(Long id)
    {
        return cmsVideoChapterMapper.selectCmsVideoChapterById(id);
    }

    /**
     * 查询视频章节列表
     * 
     * @param cmsVideoChapter 视频章节
     * @return 视频章节
     */
    @Override
    public List<CmsVideoChapter> selectCmsVideoChapterList(CmsVideoChapter cmsVideoChapter)
    {
        return cmsVideoChapterMapper.selectCmsVideoChapterList(cmsVideoChapter);
    }

    /**
     * 新增视频章节
     * 
     * @param cmsVideoChapter 视频章节
     * @return 结果
     */
    @Override
    public int insertCmsVideoChapter(CmsVideoChapter cmsVideoChapter)
    {
    	cmsVideoChapter.setId(IdUtils.getInstance(3l).nextId());
    	cmsVideoChapter.preInsert(cmsVideoChapter);
        return cmsVideoChapterMapper.insertCmsVideoChapter(cmsVideoChapter);
    }

    /**
     * 修改视频章节
     * 
     * @param cmsVideoChapter 视频章节
     * @return 结果
     */
    @Override
    public int updateCmsVideoChapter(CmsVideoChapter cmsVideoChapter)
    {
    	cmsVideoChapter.preUpdate(cmsVideoChapter);
        return cmsVideoChapterMapper.updateCmsVideoChapter(cmsVideoChapter);
    }

    /**
     * 批量删除视频章节
     * 
     * @param ids 需要删除的视频章节主键
     * @return 结果
     */
    @Override
    public int deleteCmsVideoChapterByIds(String ids)
    {
        return cmsVideoChapterMapper.deleteCmsVideoChapterByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除视频章节信息
     * 
     * @param id 视频章节主键
     * @return 结果
     */
    @Override
    public int deleteCmsVideoChapterById(Long id)
    {
        return cmsVideoChapterMapper.deleteCmsVideoChapterById(id);
    }
}
